import './App.css';
import './scss/Footer.scss'
import React, { Component,lazy,Suspense } from 'react';
import { Route,Switch,Redirect,withRouter } from 'react-router-dom'

var login = lazy( () => import('./views/Login') )
var index = lazy( () => import('./views/index/Footer'))
var search = lazy( () => import('./views/search/Search'))
var mycenter = lazy( () => import('./views/myCenter/Mycenter'))
var particulars = lazy( () => import('./views/Particulars'))
var collect = lazy( () => import('./views/Collect'))

class App extends Component {
  render() { 
    return (
      <div>
      
      <Suspense fallback={ <div className='loading'><span></span><span></span><span></span></div> }>
          <Switch>
              <Route path="/index" component={ index } />
              <Route exact path="/login" component={ login } />
              <Route exact path="/search" component={ search } />
              <Route exact path="/mycenter" component={ mycenter } />
              <Route exact path="/particulars" component={ particulars } />
              <Route exact path="/collect" component={ collect } /> 
              <Redirect from='/' to="/login" />
          </Switch>
      </Suspense>
      </div>
    );
  }
}

export default withRouter(App);